<?php
namespace app\admin\model;
use think\Model;

class SystemUpload extends Model {
	
	protected $name = 'system_upload';  			//表名
	protected $pk = 'file_id';  			//主键		
	protected $autoinc  = true;	   	    //主键是否自动增长类型
   
    //获取器->file_path
	public function getFilePathAttr($value,$data){
		return env('APP_HOST').'/'.$value;
    }
 	
    //获取轮播图
	public function getSlides($fileType,$fileGuid=0){
		$model = new self;
		$model = $model->where('file_buss_type','参数设置');
		$model = $model->where('file_type',$fileType);
		if($fileGuid) $model = $model->where('file_guid',$fileGuid);
		$model = $model->field('file_id,file_name,file_path,file_description');
		$model = $model->order('is_default desc,create_time');
		return $model->select();
	}
	  
}